package com.hogocloud.corelibrary.http.interceptor

import okhttp3.Interceptor
import okhttp3.Response
import java.io.IOException

/**
 * @Author: changkai
 * @CreateDate: 2019/4/4 11:37 AM
 * @Version: 1.0
 * @Description: Token 拦截器
 */
class TokenInterceptor : Interceptor {
    @Throws(IOException::class)
    override fun intercept(chain: Interceptor.Chain): Response {
        //获取到request
        val request = chain.request()
        //获取保存的token

        //公共参数hasmap
        try {
            val requestBuilder = request.newBuilder()


            val newRequest = requestBuilder.build()
            return chain.proceed(newRequest)
        } catch (e: Exception) {

        }

        return chain.proceed(request)
    }
}
